﻿<phone:PhoneApplicationPage 
    x:Class="PhoneInfo.Page.Most"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:controlsPrimitives="clr-namespace:Microsoft.Phone.Controls.Primitives;assembly=Microsoft.Phone.Controls" 
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
    shell:SystemTray.IsVisible="True" Style="{StaticResource TransitionPageStyle}"
    xmlns:delay="clr-namespace:Delay;assembly=PhonePerformance"
    xmlns:local="clr-namespace:PhoneInfo" toolkit:TiltEffect.IsTiltEnabled="True" >

    <phone:PhoneApplicationPage.Resources>
        <local:FixEmptyUrl x:Key="FixUrl"/>
        <local:BoolToVis x:Key="BoolToVis"/>
        <shell:ApplicationBar  x:Key="AppBar" BackgroundColor="#0a76d2"  ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton  IconUri="Icon/info/i_search.png"    Text="搜索" Click="search"/>
        </shell:ApplicationBar>
        <shell:ApplicationBar  x:Key="AppBar1" BackgroundColor="#212121"  ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton  IconUri="Icon/black/i_search.png"    Text="搜索" Click="search"/>
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBarSendSearch"  BackgroundColor="#0a76d2" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/info/i_yes.png" Text="搜索" Click="send"/>
        </shell:ApplicationBar>
        <shell:ApplicationBar x:Key="AppBarSendSearch1"  BackgroundColor="#212121" ForegroundColor="#ffffffff">
            <shell:ApplicationBarIconButton IconUri="Icon/black/i_yes.png" Text="搜索" Click="send"/>
        </shell:ApplicationBar>
        <Style x:Key="PivotStyle1" TargetType="controls:Pivot">
            <Setter Property="Margin" Value="0"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="Foreground" Value="{StaticResource PhoneForegroundBrush}"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <Grid/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:Pivot">
                        <Grid HorizontalAlignment="{TemplateBinding HorizontalAlignment}" VerticalAlignment="{TemplateBinding VerticalAlignment}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Grid Background="{TemplateBinding Background}" CacheMode="BitmapCache" Grid.RowSpan="3"/>
                            <controlsPrimitives:PivotHeadersControl x:Name="HeadersListElement" Grid.Row="1"/>
                            <ItemsPresenter x:Name="PivotItemPresenter" Margin="{TemplateBinding Padding}" Grid.Row="2"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </phone:PhoneApplicationPage.Resources>

    <!--LayoutRoot 是包含所有页面内容的根网格-->
    <Grid x:Name="LayoutRoot"  Background="{Binding Source={StaticResource Theme}, Path=cuTheme.TextBrush}">
        <!--枢轴控件-->
        <controls:Pivot SelectionChanged="Pivot_SelectionChanged" Style="{StaticResource PivotStyle1}" Margin="0,15,0,0">
            <!--枢轴项一-->
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="排行"   Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.TitleBrush}"  FontSize="54.667" />
                </controls:PivotItem.Header>
                <ListBox  x:Name="rankings" ItemsSource="{Binding}" Tap="RankingTap">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="15">
                                <Grid Width="55" Height="55" Background="#ff31b2e7" Margin="0">
                                    <Image HorizontalAlignment="Center"  VerticalAlignment="Center" Source="{Binding image}"/>
                                </Grid>
                                <TextBlock  Margin="10,0,0,0"  TextWrapping="Wrap" Text="{Binding content}" 
									        Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.BlueAndBlack}" 
                                            HorizontalAlignment="Center" FontSize="26" VerticalAlignment="Center"/>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>

            <!--枢轴项二-->
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="最热"   Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.TitleBrush}"  FontSize="54.667" />
                </controls:PivotItem.Header>
                <ListBox Name="Hot" ItemsSource="{Binding SearchResultItems}" Tap="ListBox_Tap">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                                <Grid   Width="80"  Height="100">
                                	<Image  Stretch="Uniform"    HorizontalAlignment="Center"  VerticalAlignment="Center" 
									delay:LowProfileImageLoader.UriSource="{Binding Ponhe1_picurl, Converter={StaticResource FixUrl}}"
									/>
                                </Grid>
                                <StackPanel Orientation="Vertical" Width="309" Margin="10,20,10,10" >
                                    <TextBlock Text="{Binding Ponhe1_ppname}"  FontSize="26"
                                                  Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.BlueAndBlack}" />
                                    <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                                        <TextBlock Text="("  FontSize="20" Foreground="#b94901"/>
                                        <TextBlock Text="{Binding Ponhe1_score}"  FontSize="20" Foreground="#b94901"/>
                                        <TextBlock Text="星)"  FontSize="20" Foreground="#b94901"/>
                                        <TextBlock Text="价格:"  FontSize="20" 
                                                   Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.SecondTextBrush}" Margin="5,0,0,0"/>
                                        <TextBlock Text="{Binding Ponhe1_price}"  FontSize="20" Foreground="#333333"/>
                                    </StackPanel>

                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>

            <!--枢轴项二-->
            <controls:PivotItem>
                <controls:PivotItem.Header>
                    <TextBlock Text="最新"   Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.TitleBrush}"  FontSize="54.667" />
                </controls:PivotItem.Header>
                <ListBox Name="New" ItemsSource="{Binding SearchResultItems}" Tap="ListBox_Tap">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Grid   Width="80"  Height="100">
                                    <Image  delay:LowProfileImageLoader.UriSource="{Binding Ponhe1_picurl, Converter={StaticResource FixUrl}}"  
                                            Stretch="Uniform" 
                                            VerticalAlignment="Center" HorizontalAlignment="Center"/>
                                </Grid>
                                <StackPanel Orientation="Vertical" Width="309" Margin="10,20,10,10" >
                                    <TextBlock Text="{Binding Ponhe1_ppname}"  FontSize="26"
                                                  Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.BlueAndBlack}" />
                                    <StackPanel Orientation="Horizontal" Margin="0,10,0,0">
                                        <TextBlock Text="时间:"  FontSize="20" 
                                                   Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.SecondTextBrush}" Margin="5,0,0,0"/>
                                        <TextBlock Text="{Binding Ponhe1_addtime}"  
                                                   FontSize="20" Foreground="{Binding Source={StaticResource Theme}, Path=cuTheme.SecondTextBrush}"/>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>
            </controls:PivotItem>
        </controls:Pivot>

        <Popup Width="480" Height="800" x:Name="SerchPop" >
            <Canvas Background="Black" Height="800" Width="480" Tap="Canvas_Tap">
                <TextBox x:Name="textresult" Tap="textresult_Tap"  TextWrapping="Wrap" Width="460" Height="150" Canvas.Left="10" Canvas.Top="30"/>
            </Canvas>
        </Popup>
    </Grid>


</phone:PhoneApplicationPage>